"use strict";
const common_vendor = require("../../../common/vendor.js");
const api_user = require("../../../api/user.js");
const config_app = require("../../../config/app.js");
const stores_userInfo = require("../../../stores/userInfo.js");
if (!Array) {
  const _easycom_up_avatar2 = common_vendor.resolveComponent("up-avatar");
  const _easycom_personalModule2 = common_vendor.resolveComponent("personalModule");
  const _easycom_up_button2 = common_vendor.resolveComponent("up-button");
  const _easycom_up_modal2 = common_vendor.resolveComponent("up-modal");
  const _easycom_up_toast2 = common_vendor.resolveComponent("up-toast");
  (_easycom_up_avatar2 + _easycom_personalModule2 + _easycom_up_button2 + _easycom_up_modal2 + _easycom_up_toast2)();
}
const _easycom_up_avatar = () => "../../../node-modules/uview-plus/components/u-avatar/u-avatar.js";
const _easycom_personalModule = () => "../../../components/personalModule/personalModule.js";
const _easycom_up_button = () => "../../../node-modules/uview-plus/components/u-button/u-button.js";
const _easycom_up_modal = () => "../../../node-modules/uview-plus/components/u-modal/u-modal.js";
const _easycom_up_toast = () => "../../../node-modules/uview-plus/components/u-toast/u-toast.js";
if (!Math) {
  (_easycom_up_avatar + _easycom_personalModule + _easycom_up_button + _easycom_up_modal + _easycom_up_toast)();
}
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  __name: "index",
  setup(__props) {
    const userInfoStore = stores_userInfo.useUserInfoStore();
    const uToastRef = common_vendor.ref(null);
    const userInfo = common_vendor.ref({});
    const showModal = common_vendor.ref(false);
    const getUserInfo = () => {
      api_user.policeUserInfo({ policeUserId: userInfoStore.userInfo.userId }).then((res) => {
        const { data } = res;
        data.avatar = config_app.imgPrefix + data.avatar;
        userInfo.value = data;
      }).catch((err) => {
        uToastRef.value.show({
          type: "error",
          message: err
        });
      });
    };
    common_vendor.onLoad(() => {
      getUserInfo();
    });
    return (_ctx, _cache) => {
      return {
        a: common_vendor.p({
          src: common_vendor.unref(userInfo).avatar,
          shape: "circle",
          size: "125rpx",
          mode: "scaleToFit"
        }),
        b: common_vendor.t(common_vendor.unref(userInfo).communityId === 0 ? "朝阳派出所" : common_vendor.unref(userInfo).communityName),
        c: common_vendor.t(common_vendor.unref(userInfo).userName),
        d: common_vendor.t(common_vendor.unref(userInfo).badgeNumber),
        e: common_vendor.t(common_vendor.unref(userInfo).phonenumber),
        f: common_vendor.p({
          height: 208,
          leftWidth: 165,
          showGapLine: true,
          contentStyle: {
            padding: "24rpx 16rpx",
            "align-items": "center"
          }
        }),
        g: common_vendor.o(($event) => showModal.value = true),
        h: common_vendor.o(($event) => showModal.value = false),
        i: common_vendor.p({
          type: "info",
          hairline: true,
          text: "取消"
        }),
        j: common_vendor.o(common_vendor.unref(userInfoStore).logout),
        k: common_vendor.p({
          type: "primary",
          hairline: true,
          text: "确定退出"
        }),
        l: common_vendor.p({
          show: common_vendor.unref(showModal),
          title: "确定退出登录？",
          content: "退出后部分功能将无法正常使用",
          contentTextAlign: "center"
        }),
        m: common_vendor.sr(uToastRef, "9eec5382-5", {
          "k": "uToastRef"
        })
      };
    };
  }
});
wx.createPage(_sfc_main);
